﻿using Orleans;
using System.Collections.Generic;
using System.Threading;
using System.Threading.Tasks;

namespace Puppy.ActorDb
{
    public interface IActorSet<TEntity> : IGrainWithStringKey
        where TEntity : class
    {
        Task<TEntity> FindAsync(object[] keyValues, CancellationToken cancellationToken = default);

        Task AddOrUpdateAsync(TEntity entity);

        Task AddOrUpdateRangeAsync(params TEntity[] entities);

        Task AddOrUpdateRangeAsync(IEnumerable<TEntity> entities, CancellationToken cancellationToken = default);

        Task RemoveAsync(TEntity entity);

        Task RemoveRangeAsync(params TEntity[] entities);

        Task RemoveRangeAsync(IEnumerable<TEntity> entities);

        Task<List<string>> GetAllKeyAsync();

        Task<long> CountAsync();
    }
}
